/**
 * Copyright (c) 2024-2025 National Fundamental Software of China Co., Ltd.
 *
 * You should have find a copy of NFSChina License. If not, please contact us
 * by email <os_support@nfschina>
 *
**/

/*
SPDX-FileCopyrightText: 2016 Martin Gräßlin <mgraesslin@kde.org>

SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
*/
#pragma once

#include <KConfigPropertyMap>
#include <KPackage/Package>
#include <KSharedConfig>
#include <QtDBus/QtDBus>  
#include <KConfigGroup>

class KConfigLoader;

namespace KCMWallpaper
{

class WallpaperIntegration : public QObject
{
    Q_OBJECT
    Q_PROPERTY(QString pluginName READ pluginName NOTIFY packageChanged)
    Q_PROPERTY(KConfigPropertyMap *configuration READ configuration NOTIFY configurationChanged)

public:
    explicit WallpaperIntegration(QObject *parent);
    ~WallpaperIntegration() override;

    void init();

    QString pluginName() const
    {
        return m_pluginName;
    }
    void setPluginName(const QString &name);

    KPackage::Package package() const
    {
        return m_package;
    }
    KConfigPropertyMap *configuration() const
    {
        return m_configuration;
    } 

Q_SIGNALS:
    void packageChanged();
    void configurationChanged();
    
    /**
     * This is to keep compatible with WallpaperInterface in plasma-framework.
     * It doesn't have any practical use.
     */
    void repaintNeeded();

private:
    KConfigLoader *configScheme();
    KConfigGroup loadGroup();

    QString m_pluginName;
    QString m_image;
    QString m_previewImage;
    KPackage::Package m_package;
    KConfigLoader *m_configLoader = nullptr;
    KConfigPropertyMap *m_configuration = nullptr;
};
 

}
